package com.xujiang.common_core.util.ourexception;

/**
 * @author xujiang
 * @version 2017-06-30 18:09
 */
public class NetServerException extends NetException {

    private Object mErrorBody;

    public NetServerException(String errorMessage, Object errorBody) {
        super(errorMessage, null);
        mErrorBody = errorBody;
    }

    public NetServerException(Object errorBody) {
        super("Error", null);
        mErrorBody = errorBody;
    }

    @SuppressWarnings("unchecked")
    public <T> T getErrorBody() {
        return (T) mErrorBody;
    }

    public void setErrorBody(Object mErrorBody) {
        this.mErrorBody = mErrorBody;
    }

    @Override
    public String toString() {
        return "msg: " + getMessage() + " { " + mErrorBody + " } ";
    }
}
